@import "variables";

//reset
* {
  box-sizing: border-box;
  outline: none;
  -webkit-text-size-adjust: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html {
  font-size: 14px;
  width: 100%;
  margin: 0;
  padding: 0;
}

.el-textarea__inner {
  &::placeholder {
    color: #707275;
  }
}

body {
  background-color: map-get($colors, "bgcolor");
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  font-family: "-apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei",
    sans-serif;
  overflow-y: scroll;
  overflow-x: hidden;
}

html，body {
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
  position: absolute;
}

::-webkit-scrollbar-thumb {
  border-radius: 5px;
  background-color: rgba(120, 120, 120, 0.7);
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(120, 120, 120, 0.8);
}

::-webkit-scrollbar-thumb:active {
  background-color: rgba(120, 120, 120, 0.9);
}

::-webkit-scrollbar-track {
  border-radius: 5px;
  background-color: #f5f5f5;
}

a {
  text-decoration: none;
  color: map-get($colors, "grey");
}
ul,
li {
  list-style: none;
  color: map-get($colors, "grey");
}

@each $colorKey, $color in $colors {
  .text-#{$colorKey} {
    color: $color;
  }

  .bg-#{$colorKey} {
    background-color: $color;
  }
}

.bdr {
  border-radius: 10px;
}

// text align
@each $var in (left, center, right) {
  .text-#{$var} {
    text-align: $var !important;
  }
}

@each $sizeKey, $size in $font-sizes {
  .fs-#{$sizeKey} {
    font-size: $size * $base-font-size;
  }
}

// text overflow
.text-ellipsis {
  // display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

// flex
.d-flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

@each $key, $value in $flex-jc {
  .jc-#{$key} {
    justify-content: $value;
  }
}

@each $key, $value in $flex-ai {
  .ai-#{$key} {
    align-items: $value;
  }
}

// width, height
.w-100 {
  width: 100%;
}

.h-100 {
  height: 100%;
}

.flex-1 {
  flex: 1;
}

.flex-grow-1 {
  flex-grow: 1;
}

// m-0, mx-0
@each $typeKey, $type in $spacing-types {
  // .m-1
  @each $sizeKey, $size in $spacing-sizes {
    .#{$typeKey}-#{$sizeKey} {
      #{$type}: $size * $spacing-base-size;
    }
  }

  // .mx-1 , .my-1
  @each $sizeKey, $size in $spacing-sizes {
    .#{$typeKey}x-#{$sizeKey} {
      #{$type}-left: $size * $spacing-base-size;
      #{$type}-right: $size * $spacing-base-size;
    }

    .#{$typeKey}y-#{$sizeKey} {
      #{$type}-top: $size * $spacing-base-size;
      #{$type}-bottom: $size * $spacing-base-size;
    }
  }

  // .mt-1 { margin-top: 0.25rem; } 三层嵌套循环
  @each $directionKey, $direction in $spacing-directions {
    @each $sizeKey, $size in $spacing-sizes {
      .#{$typeKey}#{$directionKey}-#{$sizeKey} {
        #{$type}-#{$direction}: $size * $spacing-base-size;
      }
    }
  }
}

// nav
.nav {
  display: flex;
}

// borders
@each $dir in (top, right, bottom, left) {
  .border-#{$dir} {
    border-#{$dir}: 1px solid $border-color;
  }
}

.hand {
  cursor: pointer;
}

.show {
  transition: transform 0.25s ease;
  list-style: none;
}

.show:hover {
  transform: scale(1.1, 1.1);
}

.main-container {
  margin: 90px 0;
}

.page {
  width: 650px;
}

.page-article {
  // overflow: hidden;

  img {
    display: block !important;
    margin: 0 auto !important;
    width: 85% !important;
  }
}

.main-content {
  max-width: 940px;
  margin: 0px auto;
}

.archive-page {
  padding: 80px 20px 0px;

  .post-lists {
    position: relative;
    display: block;
    overflow: hidden;

    .post-list-item {
      float: left;
      width: 33.3333%;
      height: auto;
      padding: 25px;
      align-items: center;

      .post-list-item-container {
        position: relative;
        overflow: hidden;
        width: 100%;
        padding: 0;
        border-radius: 0.6rem;

        .item-label .item-title a {
          font-size: 15px;
          word-break: break-all;
          color: #34b686;
          line-height: 30px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;

          &:hover {
            font-size: 15px;
            word-break: break-all;
            color: #eb5055;
            line-height: 30px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
          }
        }
      }
    }
  }
}

.archive-page .categorys-title::before {
  position: absolute;
  top: 0;
  left: -15px;
  padding: 0 30px;
  content: "#";
  color: #34b686;
}

.post-list-item-container .item-label {
  position: relative;
  height: 120px;
  padding: 25px 20px 40px;

  .item-meta {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 0 22px 20px;
    text-align: right;

    .item-meta-date {
      font-size: 12px;
      position: relative;
      float: left;
      padding-top: 9px;
      padding-left: 9px;
      text-align: right;
      text-transform: none;
      color: #bbbbbb;
      width: 100%;
      display: flex;
      justify-content: space-between;
    }
  }
}

h2,
h3,
h4 {
  color: map-get($colors, "grey-1");
}

pre {
  padding: 8px;
  background: map-get($colors, "postcolor");
  width: 100%;
}

code {
  background: map-get($colors, "postcolor");
  padding: 2px 6px;
  color: map-get($colors, "codecolor");
}

pre,
.code {
  position: relative;
  border-radius: 5px;
  // border: 1px solid #c3ccd0;
  overflow: hidden;
  overflow-x: auto;
  padding-left: 50px !important;

  code {
    line-height: 25px !important;
  }

  ol {
    margin: 0;
  }

  ol.pre-numbering {
    position: absolute;
    top: 0;
    left: 0px;
    line-height: 25px;
    padding: 10px 0;
    list-style-type: none;
    counter-reset: sectioncounter;
    margin-bottom: 0;

    li {
      margin-top: 0 !important;

      &:before {
        content: counter(sectioncounter) "";
        color: #4ebbaa;
        counter-increment: sectioncounter;
        display: inline-block;
        width: 40px;
        text-align: center;
        border-right: solid 1px rgba(0, 0, 0, 0.53);
      }
    }
  }

  i.code-copy {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #464d5e;
    padding: 3px;
    margin: 3px 3px 0 0;
    font-size: 11px;
    border-radius: inherit;
    color: #f1f1f1;
    cursor: pointer;
    display: none;
  }

  &:hover i.code-copy {
    display: block;
  }
}

@media screen and (max-width: 768px) {
  .post-list-item {
    width: 50% !important;
  }
}

@media screen and(max-width:580px) {
  .page {
    width: 100%;
  }

  .res {
    width: 100% !important;
  }

  .page-article {
    margin: 0 auto;
    width: 95%;

    img {
      width: 85%;
    }
  }
}

@media screen and (max-width: 480px) {
  .post-list-item {
    width: 100% !important;
  }
}
